package com.ruoyi.web.controller.personnel;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.personnel.domain.Job;
import com.ruoyi.personnel.service.JobService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/job")
public class JobController extends BaseController {

    @Autowired
    private JobService jobService;

    @GetMapping("/queryByPage")
    public TableDataInfo queryByPage(String searchValue) {
        startPage();
        return getDataTable(jobService.queryByPage(searchValue));
    }

    @GetMapping("/getList")
    public TableDataInfo getList() {
        return getDataTable(jobService.getList());
    }

    @PostMapping("/insert")
    public AjaxResult insert(@RequestBody Job job) {
        return success(jobService.insert(job));
    }

    @PostMapping("/update")
    public AjaxResult update(@RequestBody Job job) {
        return success(jobService.update(job));
    }

    @DeleteMapping("/delByIds/{ids}")
    public AjaxResult delByIds(@PathVariable Long[] ids) {
        return success(jobService.delByIds(ids));
    }

    @GetMapping("/getJobById")
    public AjaxResult getJobById(Integer id) {
        return success(jobService.getJobById(id));
    }
}
